<%@ page language="java" contentType="text/html; charset=UTF-8"
	import="com.zmht.specedu.vo.Soundstudy,com.zmht.specedu.frame.model.PageInfoModel,java.util.*,com.zmht.specedu.frame.util.ConstantsVars"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	/**
	 * @author 谭湘元
	 * @since 2009/04/23
	 */

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%PageInfoModel infoModel = (PageInfoModel)request.getAttribute(ConstantsVars.PAGINATION_MODEL_KEY); %>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<fmt:setBundle basename="PathResource" scope="session" />
<title>聋校语言学习及矫治系统</title>
<link href="<%=request.getContextPath() %>/<fmt:message key='StylePath' />style.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript">
		function jumpToPage(pageNum){
			if(isNaN(pageNum)){
				alert("页数必须是数字！");
				document.forms[0].currentPage.select();
				document.forms[0].currentPage.focus();
				return;
			}
			var pageSize = document.getElementById("pageSize").value;
			if(isNaN(pageSize)|| pageSize<1){
				alert("每页显示条数必须是数字且大于1！");
				document.getElementById("pageSize").select();
				document.getElementById("pageSize").focus();
				return;
			}
			var total = <%=infoModel.getTotalCount() %>;
			var currentPageCount = total%pageSize > 0 ? (total/pageSize)+1 : total/pageSize;
			if(pageNum<1 || pageNum>currentPageCount){
				alert("输入页数必须大于0且小于最大页数！");
				document.forms[0].currentPage.select();
				document.forms[0].currentPage.focus();
				return;
			}
			document.forms[0].currentPage.value = pageNum;
			document.forms[0].submit();
		}
	</script>
</head>
<body>
	   <%
	  	if(infoModel!=null){
	   %>
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
          <tr>
            <td bgcolor="#e6f0f8"><table width="100%" border="0" cellpadding="3" cellspacing="0">
                <tbody>
                  <tr>
                    <td width="10">&nbsp;</td>
                    <td align="right"><input class="boxcopy2" maxlength="5" style="width:20px;" value="<%=infoModel.getCurrentPage() %>" name="currentPage" /> / <%=infoModel.getPageCount() %>页 
						&nbsp;<%if(infoModel.getCurrentPage()==1) {%><font color="#c0c0c0">首页&nbsp;前页 </font>
							<%}else{ %>
								<a href="javascript:jumpToPage('1');">首页</a>&nbsp;<a href="javascript:jumpToPage('<%=infoModel.getCurrentPage()-1 %>');">前页</a><%} %> 
                    	&nbsp;<%if(infoModel.getCurrentPage()==infoModel.getPageCount()) {%><font color="#c0c0c0">后页&nbsp;尾页 </font>
                    		<%}else{ %>
								<a href="javascript:jumpToPage('<%=infoModel.getCurrentPage()+1 %>');">后页</a>&nbsp;<a href="javascript:jumpToPage('<%=infoModel.getPageCount() %>');">尾页</a><%} %>   
						&nbsp;共 <%=infoModel.getTotalCount() %> 条记录，每页显示
                      <input class="boxcopy2" 
                  maxlength="3" style="width:20px;" value="<%=infoModel.getPageSize() %>" name="pageSize" id="pageSize" />
                    条 </td>
                    <td width="20" align="right"><img onclick="jumpToPage(document.forms[0].currentPage.value);" style="cursor: hand;" height="16" width="18" 
                  src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />button_go.gif" 
            name="btnJump" /></td>
                  </tr>
                </tbody>
            </table></td>
          </tr>
        </table>
	   <%
	   }
	    %>
</body>
</html>